<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh">
<head>
<%@include file="../../commons/meta.jsp" %> 
<link rel="stylesheet" href="${ctx}assets/plugins/pure/pure-min.css" media="all" />
<script type="text/javascript">
debugs("${ctx} --- user-role.jsp");
function validateForm(){
    if(empty($("#username").val())){
    	alertError('<fmt:message key="Please.enter.your.user.name"/>');
		return false;
    }
    if(empty($("#roleCodes").val())){
    	alertError('<fmt:message key="Please.select"/>');
		return false;
    }

    $("#forms").submit();   
}
//  关闭弹出框 
jQuery(document).ready(function() { 
	$("#back_btn").click(function() {
		window.location.href="${ctx}admin/adminuser/"
	});
}); 
</script>
</head>
<body>
	<%@include file="../../commons/head.jsp" %> 
	<div class="content">
		<%@include file="../../commons/menu.jsp" %> 
		<!--右侧展示部分-->
		<div class="right-zq">
			<!--center content-->
			<div class="dynamic">
        		<div class="role dynamiclayer" style="display:block;">
        		<div class="title orange2"><span class="left"><fmt:message key='User.permissions'/></span><label> > </label><span><fmt:message key='User.management'/></span><label> > </label><span><fmt:message key='Grant.role'/></span></div>
					<form class="" id="forms" method="post" action="${ctx}admin/adminuser/role">
						<div class="news-table">
							<table>
								<tr>
									<td class="item"><fmt:message key='Login.name'/></td>
           							<td width="40%"><input id="username" name="username" type="text"  placeholder="" value="${obj.username }"  readonly="readonly"/></td>
									<%-- <td><span class="small"><fmt:message key='Login.name.format'/></span></td> --%> 
								</tr>
								<tr>
								
									<td class="item"><fmt:message key='role'/></td>
									<td width="20%">
										<select id="roleCodes" name="roleCodes" style="text-align: center;width:80%">  
											<c:if test="${allRoles !=null and not empty allRoles}">
												<%-- <option value="" >--<fmt:message key='Member.management'/>--</option> --%>
												<c:forEach items="${allRoles}" var="objl" varStatus="status">
							                      <option value="${objl.key}"  <c:if test="${roles == objl.key }">selected="selected"</c:if> >${objl.value }</option>
							   	                </c:forEach>
											</c:if>
										</select>
									</td>
									<td></td>
								</tr>
								<tr>
									<td></td>
									<td width="40%">
										<button class="orange2" type="button" onclick="validateForm()">
											<fmt:message key='Grant.role'/>&nbsp;<i class="fa fa-floppy-o"></i>
										</button>
										&nbsp;&nbsp;
										<button class="orange2" type="button" id="back_btn">
											<fmt:message key='sys.retu'/>&nbsp;<i class="fa fa-undo"></i>
										</button>
									</td>
									<td></td>
								</tr>
							</table>
						</div>
					</form>
				</div>
			</div>
			<!--center content over-->
		</div>
	</div>
  
<%@include file="../../commons/footpop.jsp" %> 
<!-- 页尾，提示消息 -->
<jsp:include page="../../commons/foot_message.jsp"></jsp:include> 
</body>
</html>
